<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateOfferTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateOfferLabel_amount}" for="amount" />
                    <h:inputText id="amount" value="#{offerController.selected.amount}" title="#{bundle.CreateOfferTitle_amount}" required="true" requiredMessage="#{bundle.CreateOfferRequiredMessage_amount}"/>
                    
                    <c:if test="#{sessionScope.agent==true}"> 
                        <h:outputLabel value="#{bundle.CreateOfferLabel_clientUsername}" for="clientUsername" />
                        <h:selectOneMenu id="clientUsername" value="#{offerController.selected.clientUsername}" title="#{bundle.CreateOfferTitle_clientUsername}" required="true" requiredMessage="#{bundle.CreateOfferRequiredMessage_clientUsername}">
                            <f:selectItems value="#{clientController.itemsAvailableSelectOne}"/>
                        </h:selectOneMenu>
                    </c:if>
                    <h:outputLabel value="#{bundle.CreateOfferLabel_idAnnounce}" for="idAnnounce" />
                    <h:selectOneMenu id="idAnnounce" value="#{offerController.selected.idAnnounce}" title="#{bundle.CreateOfferTitle_idAnnounce}" required="true" requiredMessage="#{bundle.CreateOfferRequiredMessage_idAnnounce}">
                        <f:selectItems value="#{announceController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:commandLink action="#{offerController.create}" value="#{bundle.CreateOfferSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{offerController.prepareList}" value="#{bundle.CreateOfferShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.CreateOfferIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
